FROM madnight/alpine-wkhtmltopdf-builder:0.12.5-alpine3.10-705860667 as builder
FROM axboy/leanote:latest as fontBuilder

FROM alpine:3.12
MAINTAINER zcw
ENV TZ=Asia/Shanghai

COPY --from=builder /bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
COPY --from=fontBuilder /usr/share/fonts/truetype /usr/share/fonts/truetype

RUN apk update && apk add --no-cache tzdata mongodb-tools \
    libgcc libstdc++ libx11 glib libxrender libxext libintl \
    ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    mkdir /data/ && \
    wget http://static.axboy.cn/leanote/leanote-linux-amd64-v2.6.1.bin.tar.gz -O /root/leanote.tar.gz && \
    tar -xzf /root/leanote.tar.gz -C /data/ && \
    chmod +x /data/leanote/bin/run.sh && \
    chmod +x /usr/local/bin/wkhtmltopdf && \
    rm -f /root/leanote.tar.gz

EXPOSE 9000
CMD sh /data/leanote/bin/run.sh